/*
 * @file com.chuanlian.mini.pay.service.PayOrderService.java
 * @date 2021/10/19
 * @author lhz
 * @copyright 马丁洛克 Corporation 2021 版权所有
 * @version 0.0.1
 */
/****
 * @className PayOrderService
 * @describe 支付订单实现
 * @author lhz
 * @date 2021/10/19 04:28
 * @version 0.0.1
 */

package com.sinux.generality.provider.pay.service;

import com.sinux.generality.provider.pay.entity.GptPayOrder;
import com.sinux.generality.provider.pay.entity.GptPayOrderRefund;

import java.io.IOException;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Map;

/**
 * @author lhz
 * @version 0.0.1
 * @className PayOrderService
 * @describe 支付订单接口
 * @date 2021/10/19 11:33
 */
public interface PayOrderService {
    /****
     * jsApiApy 小程序调起支付数据组织签名(jsapi)
     * @author lhz
     * @param businessOrderId
     * @param orderType  创建支付订单类型 1-合单支付，2-会员费单独支付
     * @return java.util.Map<java.lang.String,java.lang.Object>
     */

    Map<String, Object> jsApiApy(Long businessOrderId, Integer orderType);
    /****
     * createPayOrder 创建支付订单
     * @author lhz
     * @param payOrder 支付主单
     * @param businessOrderId 业务订单id
     * @param orderType 支付订单方式：1-合单支付，2-会员费单独支付
     * @param payType 支付类型：1-微信支付
     * @return GptPayOrder
     */

    GptPayOrder createPayOrder(GptPayOrder payOrder, Long businessOrderId, Integer orderType, Integer payType);

    /****
     * createRefundOrder 创建退款订单
     * @author lhz
     * @param businessId 业务订单id
     * @param refundMoney 退款金额
     * @param type 退款业务订单类型：1-门诊 2-药费 3-制药费 4-闪送费,5-针灸费,6-线上问诊
     * @throws IOException
     * @return java.util.Map<java.lang.String,java.lang.Object>
     */

    Map<String,Object> createRefundOrder(Long businessId, BigDecimal refundMoney, Integer type);
    /****
     * refundOrder 向微信发起退款
     * @author lhz 
     * @param gptPayOrderRefund 退款单
     * @throws IOException
     * @return java.util.Map<java.lang.String,jva.lang.Object>
     */
    
    Map<String,Object> refundOrder(GptPayOrderRefund gptPayOrderRefund);

    /****
     * handleBusinessState 支付成功后处理业务
     * @author lhz
     * @param payOrder 支付订单
     * @param successTime 支付成功时间
     * @return void
     */

    void handleBusinessState(GptPayOrder payOrder, LocalDateTime successTime);

    /****
     * closePayOrder 关单
     * @author lhz
     * @param advanceId
     * @return java.util.Map<java.lang.String, java.lang.Object>
     */

    Map<String, Object> closePayOrder(Long advanceId);
}
